﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Library.Web.Data;

namespace Library.Web.ViewModels
{
    public class RequestBookViewModel : BaseViewModel
    {
        public Models.RequestBook Request { get; set; }

        internal void Save()
        {
            if (Request != null)
            {
                var book = new Book
                {
                    Authors = Request.BookAuthors,
                    Title = Request.BookTitle,
                    IsLoaned = false,
                    ImageUrl = string.Empty
                };

                Repository.Add(book);
                Repository.Save();
            }
        }
    }
}